export default {
  namespaced: true,
  state: {
    // 是否显示提示框
    isShowToast: false,
    // toast的内容
    toastMsg: "默认内容",
    // 提示类型--图标
    toastType: "",
  },
  getters: {},
  mutations: {
    // 修改显示提示框状态
    changeShowToast(state, payload) {
      state.isShowToast = payload.isShow;
      if (payload.isShow) {
        state.toastMsg = payload.title;
        state.toastType = payload.type;
      }
    },
  },
  actions: {
    asyncChangeToast(context, payload) {
      context.commit("changeShowToast", payload);
      setTimeout(() => {
        context.commit("changeShowToast", {
          isShow: false,
        });
      }, 1500);
    },
  },
};
